package mysql;

import java.sql.Connection;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class Eadp {

	
	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
//		Class.forName("com.mysql.jdbc.Driver");
		Class.forName("net.sourceforge.jtds.jdbc.Driver");
		Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection srcConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://172.16.1.7:1433/eadp5_1", "sa", "eplugger");
		Connection tarConn = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@172.16.1.3:1521:orcl", "eadp5", "eplugger");
//		Connection tarConn = java.sql.DriverManager.getConnection("jdbc:mysql://172.16.1.14:3306/eadp5?useUnicode=true&characterEncoding=utf-8&autoReconnect=true", "eadp5", "eplugger");
		try {
			DBInfo srcInfo = new DBInfo(srcConn, null, DBName.SqlServer2005);
			DBInfo tarInfo = new DBInfo(tarConn, "eadp5", DBName.Oracle);
//			DBUtils.tableConvertA2B(srcConn, tarConn, srcDia, tarDia, new String[]{"DM_SUBJECT"});
//			DBUtils.tableConvertA2B(srcInfo,tarInfo,null);
			DBUtils.dbConvertA2B(srcInfo, tarInfo, true);
		} finally{
			srcConn.close();
			tarConn.close();
		}
	}

}
